<?php
/**
 * Pertyler DatabaseManagement
 * View
 * InsertRow
 *
 * @author	Emre Hasegeli <hasegeli@gmail.com>
 * @license	GNU General Public License v3
 */

if(!($Content instanceof \Pert\Page_Content))
	return;
?>
<h4 ><?php echo $Content->TableName; ?>
</h4>

<form action="InsertRow.php?Table=<?php echo $Content->TableId; ?>"
		method="post" >

	<table ><?php
foreach($Content->ColumnIdArray AS $columnId)
{

	if(isset($Content->ReferancedColumnArray[$columnId]))
	{
?>
		<tr >
			<td >
				<a href="<?php
		if(isset($Content->ReferancedColumnTableIdArray[$columnId]))
		{
?>Table.php?Table=<?php echo $Content->ReferancedColumnTableIdArray[$columnId];
		}
?>" ><?php echo $Content->ReferancedColumnArray[$columnId]; ?>
				</a>
			</td>

			<td >
				<select name="<?php echo $columnId; ?>[]"
						multiple="multiple" ><?php
		if(isset($Content->ReferancedColumnTableValueArrayArray[$columnId]))
			foreach($Content->ReferancedColumnTableValueArrayArray[$columnId] AS $columnValueId => $referancedColumnValue)
			{
?>

					<option value="<?php echo $columnValueId; ?>" ><?php echo $referancedColumnValue; ?>
					</option><?php
			}
?>

				</select>
			</td>
		</tr><?php
	}

	if(isset($Content->StringColumnArray[$columnId]))
	{
?>		<tr >
			<td ><?php echo $Content->StringColumnArray[$columnId]; ?>
			</td>

			<td >
				<input type="text"
						name="<?php echo $columnId; ?>"<?php
		if(isset($Content->StringColumnValueArray[$columnId]))
		{
?>
						value="<?php echo $Content->StringColumnValueArray[$columnId]; ?>"<?php
		}
?> />

			</td>
		</tr><?php
	}

	if(isset($Content->NumericColumnArray[$columnId]))
	{
?>		<tr >
			<td ><?php echo $Content->NumericColumnArray[$columnId]; ?>
			</td>

			<td >
				<input type="text"
						name="<?php echo $columnId; ?>"<?php
		if(isset($Content->NumericColumnValueArray[$columnId]))
		{
?>
						value="<?php echo $Content->NumericColumnValueArray[$columnId]; ?>"<?php
		}
?> />

			</td>
		</tr><?php
	}

	if(isset($Content->DateColumnArray[$columnId]))
	{
?>		<tr >
			<td ><?php echo $Content->DateColumnArray[$columnId]; ?>
			</td>

			<td >
				<input type="text"
						name="<?php echo $columnId; ?>"<?php
		if(isset($Content->DateColumnValueArray[$columnId]))
		{
?>
						value="<?php echo $Content->DateColumnValueArray[$columnId]; ?>"<?php
		}
?> />

			</td>
		</tr><?php
	}

	if(isset($Content->BooleanColumnArray[$columnId]))
	{
?>		<tr >
			<td ><?php echo $Content->BooleanColumnArray[$columnId]; ?>
			</td>

			<td >
				<input type="checkbox"
						name="<?php echo $columnId; ?>" />

			</td>
		</tr><?php
	}
}
?>
	</table>

	<p >
		<input type="submit"
				name="Insert"
				value="Submit" />

	</p>
</form>
